<template>
  <el-card 
    class="card-component" 
    :shadow="阴影显示"
    :body-style="bodyStyle"
  >
    <div v-if="标题" slot="header" class="card-header">
      <span>{{ 标题 }}</span>
    </div>
    <div class="card-content">
      {{ 内容 }}
    </div>
  </el-card>
</template>

<script>
export default {
  name: 'CardComponent',
  componentName: '卡片',
  icon: 'el-icon-tickets',
  defaultProps: {
    标题: '卡片标题',
    内容: '这是卡片内容',
    阴影显示: 'always',
    内边距: '20px',
    背景颜色: '#ffffff',
    圆角: '4px'
  },
  props: {
    标题: {
      type: String,
      default: '卡片标题'
    },
    内容: {
      type: String,
      default: '这是卡片内容'
    },
    阴影显示: {
      type: String,
      default: 'always',
      validator: value => {
        return ['always', 'hover', 'never'].includes(value);
      }
    },
    内边距: {
      type: String,
      default: '20px'
    },
    背景颜色: {
      type: String,
      default: '#ffffff'
    },
    圆角: {
      type: String,
      default: '4px'
    }
  },
  computed: {
    bodyStyle() {
      return {
        padding: this.内边距,
        backgroundColor: this.背景颜色,
        borderRadius: this.圆角
      };
    }
  }
};
</script>

<style scoped>
.card-component {
  width: 100%;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-content {
  line-height: 1.5;
}
</style>